#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Licensed Materials - Property of tenxcloud.com
# (C) Copyright 2020 TenxCloud. All Rights Reserved.
# 2020-05-31 @author lizhen

from flask import make_response
from data_set_api.root import app as server, db
from data_set_api.api import data_set, file

server.register_blueprint(data_set.blueprint)
server.register_blueprint(file.blueprint)

db.create_all()


@server.errorhandler(400)
@server.errorhandler(404)
@server.errorhandler(405)
@server.errorhandler(406)
@server.errorhandler(500)
def json_error(error):
    return make_response({'message': error.description}), error.code
